package net.mukia.model;

import javax.persistence.Column;
import javax.persistence.Embeddable;

@Embeddable
public class RToken extends BaseBean {

	private static final long serialVersionUID = -8392295894059245724L;


	@Column
	private String token;

	@Column
	private String secret;

//	@ManyToOne
//	@Cascade(value = { CascadeType.SAVE_UPDATE })
//	@JoinColumn(name = "ACCOUNT_ID")
//	private Account account;

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public String getSecret() {
		return secret;
	}

	public void setSecret(String secret) {
		this.secret = secret;
	}

//	public Account getAccount() {
//		return account;
//	}
//
//	public void setAccount(Account account) {
//		this.account = account;
//	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return super.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		try {
			if (obj instanceof RToken) {
				RToken rt = (RToken) obj;
				if (rt.getToken().equals(this.token) && rt.getSecret().equals(this.secret)) {
					return true;
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return false;
	}

}
